import Types from '../actionTypes';

let initState = {
  instructionSingle: {},
  instructionLibraryData: [],
  pageCount: 0
};

export default (state = initState, action) => {
  const newState = JSON.parse(JSON.stringify(state));
  switch (action.type) {
    case Types.GET_INSRUCTIONLIBRARY_DATA:
      newState.instructionLibraryData = action.data.data;
      newState.pageCount = action.data.pageCount;
      return newState;

    case Types.INSRUCTION_SINGLE_DATA:
      newState.instructionSingle = action.data;
      return newState;

    default:
      console.log('Types no match in instructionLibrary.js ....');
  }
  return state;
}
